package com.ruoyi.system.utils;

import com.ruoyi.system.domain.ResultVO;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;

import java.util.HashMap;
import java.util.LinkedHashMap;

/**
 * @ClassName: getToken
 * @Description: 获取萤石云token
 * @Author: liu
 * @Date: 2020/11/17 16:24
 */
@Component
public class YsyToken {

    @Value("${ysy.AppKey}")
    private  String appKey;

    @Value("${ysy.Secret}")
    private  String appSecret;

    @Value("${ysy.tokenurl}")
    private  String url;

    public ResultVO getToken(){
        MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
        params.add("appKey",appKey);
        params.add("appSecret",appSecret);
        //发送Post数据并返回数据
        ResultVO resultVo = TokenUtils.sendPostRequest(url, params);
        return resultVo;
    }

}
